package com.easyj.admin.db.model;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotBlank;

/**
 *   @title 部门
 *   @remark 
 *   @table b_department
 *   @primaryKey id
 *   @enablePage false
 *   @uniqueIndex selectUniqueByUnique(code)
 */
public class Department implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *   @title 
     *   @remark 
     *   @column id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long id;

    /**
     *   @title parent_id=0 为根
     *   @remark 系初始化时导入。组织最顶级，一般情况下，只有一个。
     *   @column parent_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long parentId;

    /**
     *   @title 
     *   @remark 
     *   @column code
     *   @dataType VARCHAR
     *   @length 40
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String code;

    /**
     *   @title 名称
     *   @remark 
     *   @column name
     *   @dataType VARCHAR
     *   @length 100
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String name;

    /**
     *   @title 
     *   @remark 
     *   @column deleted
     *   @dataType BIT
     *   @length 1
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIT
     */
    private Boolean deleted;

    /**
     *   @title 
     *   @remark 
     *   @column create_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date createTime;

    /**
     *   @title 
     *   @remark 
     *   @column modify_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date modifyTime;

    /**
     *   @title 
     *   @remark 
     *   @column operator_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType BIGINT
     */
    private Long operatorId;
    
    private Department parent;

    /**
     *   @title  类型
     *   @remark 1.公司、分公司，2.部门
     *   @column type
     *   @dataType INT
     *   @length 10
     *   @scale 0
     *   @nullable false
     *   @jdbcType INTEGER
     */
    private Integer type;
    

    private Long companyId;
    
    private String companyName;
    

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Long getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

   
    public Department getParent() {
		return parent;
	}

	public void setParent(Department parent) {
		this.parent = parent;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}
	
	
	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	@Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Department other = (Department) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", id=").append(id);
        sb.append(", parentId=").append(parentId);
        sb.append(", code=").append(code);
        sb.append(", name=").append(name);
        sb.append(", deleted=").append(deleted);
        sb.append(", createTime=").append(createTime);
        sb.append(", modifyTime=").append(modifyTime);
        sb.append(", operatorId=").append(operatorId);
        sb.append(", type=").append(type);
        sb.append("]");
        return sb.toString();
    }
}